/**
 * @author toplabs
 * 添加fork me丝带
 */
(() => {
    const tags = {
        tag: 'div'
    };
    const html = document.createElement(tags.tag);
    html.innerHTML = `
    <link rel='stylesheet' href='http://lzyws739307453.gitee.io/web-top-labs/WebCSS/TopLabsSilkRibbonForkMe.css'>
    <div class="silk-ribbon">
        <span class="silk-ribbon-git tl-vh-center">
            <a class="tl-pointer-events-auto" href="https://github.com/lzyws739307453" target="_blank">
                <i class="iconfont icon-git"></i><span class="tl-margin-left-5">Fork Me</span>
            </a>
        </span>
    </div>`;
    const className = document.getElementsByClassName('silk-ribbon-wrapper');
    for (let i = 0; i < className.length; i++) {
        if (hasClass(className[i], 'el-card')) {
            className[i].childNodes.forEach((item) => {
                if (item.className === 'el-card__body') {
                    return item.appendChild(html)
                }
            })
        } else {
            className[i].appendChild(html);
        }
    }
})();
/* 判断节点是否包含某个class */
function hasClass (element, cls) {
    return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
}